﻿using System;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.pp.processor.type.comm;
using SharpSqlAnalyzer.pp.utils;
using SharpSqlAnalyzer.stmt;

namespace SharpSqlAnalyzer.pp.processor.type.createtable
{
	// Token: 0x02000247 RID: 583
	public class CreateTableConstraintAlignProcessor : AbstractProcessor
	{
		// Token: 0x06001305 RID: 4869 RVA: 0x0031C440 File Offset: 0x0031A640
		public override void process(TParseTreeNode nodeArg)
		{
			TCreateTableSqlStatement tcreateTableSqlStatement = nodeArg as TCreateTableSqlStatement;
			TConstraintList tableConstraints = tcreateTableSqlStatement.TableConstraints;
			if (tableConstraints == null || tableConstraints.size() == 0)
			{
				return;
			}
			int num = SourceTokenOperator.curColumnNumberVT(SourceTokenSearcher.forwardSearch(tcreateTableSqlStatement.TargetTable.endToken, 5, "("));
			TConstraint constraint = tableConstraints.getConstraint(0);
			SourceTokenOperator.removeWhitespaceAndReturnFromEnd(this.Option, constraint.startToken);
			SourceTokenOperator.addBefore(this.Option, constraint.startToken, SourceTokenOperator.createReturnSourceToken());
			SourceTokenOperator.addBefore(this.Option, constraint.startToken, SourceTokenOperator.createWhitespaceSourceToken(num + 1));
		}
	}
}
